var broswerFlag, pResizeTimer = null;

$(function() {
    if (window.navigator.userAgent.indexOf("MSIE") >= 1) {
        var a = window.navigator.userAgent.substring(30, 33);
        "6.0" == a ? broswerFlag = "IE6" : "7.0" == a && (broswerFlag = "IE7");
    }
}), jQuery.fn.center = function(a) {
    var c, d, e, b = this;
    a ? (d = $(window).height() / 2 - this.height() / 2, e = $(window).width() / 2 - this.width() / 2, 
    d = 0 > d ? 0 : d, b.stop(), b.animate({
        marginTop: d,
        marginLeft: e
    }, 150, "linear")) : (c = $(window).height() / 2 - this.height() / 2, c = 0 > c ? 0 : c, 
    b.css("margin-top", c), b.css("margin-left", $(window).width() / 2 - this.width() / 2), 
    $(window).resize(function() {
        "IE6" == broswerFlag || "IE7" == broswerFlag ? (pResizeTimer && clearTimeout(pResizeTimer), 
        pResizeTimer = setTimeout(function() {
            b.center(a);
        }, 100)) : b.center(!a);
    }));
};